import React from "react";
import {Button, Upload} from "antd";
import { UploadOutlined } from '@ant-design/icons';

export default function Upload() {



    const uploadExcelProps = {
        onRemove: (file) => {
            setFileList((state) => {
                const index = fileList.indexOf(file);
                const newFileList = fileList.slice();
                newFileList.splice(index, 1);
                return newFileList;
            });
        },
        beforeUpload: (file) => {
            let tmpFileList = fileList
            tmpFileList.push(file)
            setFileList(tmpFileList)
            return false;
        }
    }

    return(
        <Upload name="file" multiple={true} {...uploadExcelProps} listType="picture">
            <Button icon={<UploadOutlined />}>上传</Button>
        </Upload>
    )
}
